package net.zabuchy.meeting.dao;
 
import java.util.List;
 
import net.zabuchy.meeting.entity.Meeting;

import org.apache.log4j.Logger;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
 

public class MeetingDaoImpl extends HibernateDaoSupport implements MeetingDao {
 
	private static final Logger LOGGER = Logger.getLogger(MeetingDaoImpl.class.getName());
	

	public void add(Meeting meeting) {
		getHibernateTemplate().save(meeting);
	}

	public void update(Meeting meeting) {
		getHibernateTemplate().update(meeting);
	}

	public void delete(Meeting meeting) {
		getHibernateTemplate().delete(meeting);
		
	}
	
	public List findAll() {
		return getHibernateTemplate().find("from Meeting");
	}
	 
	public Meeting findById(int id) {
		return (Meeting) getHibernateTemplate().find("from Meeting where MEETING_ID=?", id).get(0);
	}
	
	public List<Meeting> findByLeadingUser(String leadingUser) {
		return getHibernateTemplate().find("from Meeting where LEADING_USER=?", leadingUser);
	}
	
}